package com.example.custinfoprovider.controller;

import com.example.custinfoprovider.service.CustInfoService;
import com.example.custinfoprovider.entity.CustInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("custom-provider")
public class CustInfoController {
    @Autowired
    private CustInfoService custInfoService;

    @GetMapping("/selectCustomBySql/{currentPage}/{pageSize}")
    public List<CustInfo> selectFindBySql(@PathVariable("currentPage") int currentPage, @PathVariable("pageSize") int pageSize) {
        return custInfoService.selectCustomBySql(currentPage, pageSize);
    }

    @GetMapping("/getTotal")
    public Integer getTotal() {
        return custInfoService.getTotal();
    }
}
